I have a set of linear algebraic equations, Ax=By. Where A is matrix of 36x20 and x is a vector of 20x1, B is 36x13 and y is 13x1. Rank(A)=20. Because system is overdetermined, so least squares solution is possible, i,e; x = (A^TA)^-1A^TBy. I want the solution so that the residual error e = Ax-By should be minimized. I was using Maple to take the transpose and inverse of the matrices but taking inverse of such a big matrix takes much longer time and RAM. I even spend the whole day to take the matrix inverse but due to shortage of RAM memory it was interrupted. This is very slow and I guess not achievable with Maple.
Could anybody suggest any solution of way to do so in C++ or any other way of solving equations rather than taking inverses and transposes.
Formation of matrices,
[ 1 0 0 ...0]
[ 0 1 0 ...0]
[ 0 0 1 ...0] [LinearVelocity_x]
[ 0 0 0 ...1] [LinearVelocity_y]
[ . . . ....], x=[LinearVelocity_z]
A = [ . . . ....] [RotationalVelocity_ROLL]
[ . . . ....] [RotationalVelocity_PITCH]
[ 1 0 0 ...0] [RotationalVelocity_YAW]
[ 0 1 0 ...0]
[ 0 0 1 ...0]
[ 0 0 0 ...1]
x is basically position(x,y,z) and orientation(Roll, Pitch and Yaw) vector.
However B is not a matrix of fixed ones
and zeros
. B is a matrix with elements of sin
, cos
of angles which are real time sensors data not a fixed data. In maple B is almost a matrix of variables and fixed elements, you can say a dense sparse
matrix. Meanwhile, y is a vector of all the sensors or encoders.